<?php

/**
 * Created by PhpStorm.
 * Author: ls
 * Time: 2023/8/23 11:26
 * Desc:租车请求验证
 */
class Request_Api_V2_Car extends Request_Api_V2_Base
{
    public function __construct($request_param)
    {
        parent::__construct($request_param);
    }

    public function recommend()
    {
        $this->rules = [
            ['pagesize', ['not_empty', 'digit', $this->rule_min(1)]],
            ['page', ['digit', $this->rule_min(0)]],
        ];

        return $this;
    }

    public function get_attr_list()
    {
        $this->rules = [
            ['kind_id', ['digit', $this->rule_min(0)]],
            ['pagesize', ['not_empty', 'digit', $this->rule_min(1)]],
            ['page', ['digit', $this->rule_min(0)]],
        ];

        return $this;
    }

    public function general_query()
    {
        $this->rules = [
            ['car_kind_id', ['digit', $this->rule_min(0)]],
            ['pagesize', ['digit', $this->rule_min(1)]],
            ['page', ['digit', $this->rule_min(0)]],
            ['time_desc', ['not_empty']],
            ['use_type', ['digit','not_empty']],
        ];

        return $this;
    }

    public function get_day_suitlist()
    {
        $this->rules = [
            ['time_desc', ['not_empty']],
            ['carid', ['not_empty', 'digit', $this->rule_min(1)]],
        ];

        return $this;
    }

    public function detail()
    {
        $this->rules = [
            ['product_id', ['not_empty', 'digit', $this->rule_min(1)]],
            ['time_desc', ['not_empty']],
        ];

        return $this;
    }

    public function price()
    {
        $this->rules = [
            ['suit_id', ['not_empty', 'digit', $this->rule_min(1)]],
            ['year', ['digit', $this->rule_min(1)]],
            ['month', ['digit', $this->rule_min(1)]],
        ];

        return $this;
    }

    public function get_everyday_price()
    {
        $this->rules = [
            ['suit_id', ['not_empty', 'digit', $this->rule_min(1)]],
            ['together_id', ['digit', $this->rule_min(1)]],
            ['is_seckill', ['digit', $this->rule_min(1)]],
            ['use_type', ['not_empty']],
            ['starttime', [$this->rule_date_format('Y-m-d')]],
            ['endtime', [$this->rule_date_format('Y-m-d')]],
        ];

        return $this;
    }

    public function get_time_count_price()
    {
        $this->rules = [
            ['suit_id', ['not_empty', 'digit', $this->rule_min(1)]],
            ['product_id', ['not_empty', 'digit', $this->rule_min(1)]],
            ['starttime', [$this->rule_date_format('Y-m-d')]],
            ['endtime', [$this->rule_date_format('Y-m-d')]],
        ];

        return $this;
    }

    public function car_suit()
    {
        $this->rules = [
            ['suit_id', ['not_empty', 'digit', $this->rule_min(1)]],
            ['car_id', ['not_empty', 'digit', $this->rule_min(1)]],
            ['is_seckill', ['digit', $this->rule_min(0)]],
            ['together_id', ['digit', $this->rule_min(0)]],
        ];

        return $this;
    }

    public function add_order()
    {
        $this->rules = [
            ['product_auto_id', ['not_empty', 'digit', $this->rule_min(1)]],
            ['suit_id', ['not_empty', 'digit', $this->rule_min(1)]],
            ['ding_num', ['not_empty',  'digit',  $this->rule_min(1)]],
//            ['usedate', ['not_empty', $this->rule_date_format('Y-m-d')]],
//            ['departdate', ['not_empty', $this->rule_date_format('Y-m-d')]],
            ['time_desc', ['not_empty']],
            ['linkman', ['not_empty']],
            ['linktel', ['not_empty', 'phone']],
            ['together_id', ['digit']],
            ['join_id', ['digit']],
        ];
        //自定义规则
        $this->validation->rule('mid',array('Rule_Member','need_member'));

        return $this;
    }
}